<template>
	<view>
		<view class="list">
			<view class="item">
				<u-cell-group>
					<u-cell @click="$pub.go(`/pages/reViewDetail/reViewDetail?data=${val.prescriptionId}`)"
						v-for="val,i in list" :key="i" :title="val.uname" :value="val.uoptype"
						:label="val.vreateTime"></u-cell>
				</u-cell-group>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		checkOpenGPSServiceByAndroid
	} from '@/utils/device.js'
	export default {
		data() {
			return {
				mapData: {
					"type": "1",
					"userId": uni.getStorageSync('userInfo').uemployeeid,
					"x": uni.getStorageSync('map').x,
					"y": uni.getStorageSync('map').y,
				},
				list: []
			}
		},
		onShow() {
			this.getList()
		},
		onLoad() {
			this.getGps()
		},
		methods: {
			/*  */
			async getList() {
				let data = {
					"x": uni.getStorageSync('map').x,
					"y": uni.getStorageSync('map').y,
					"pageNum": 1,
					'pageSize': 5,
				}
				let re = await this.$API.abbreviationforApi.getList(data)
				this.list = re.list
			},



			/*  */
			async chatList() {
				let re = await this.$API.abbreviationforApi.getList(1)
				console.log(re, "re");
				this.messageList = re
			},
			/*  */
			async chatList() {
				let re = await this.$API.abbreviationforApi.getGoodsById(1)
				console.log(re, "re");
				this.messageList = re
			},


			async getMap() {
				let that = this
				let re = await this.$API.mapApi.coordinate(this.mapData);
			},
			getGps(e) {
				let that = this
				uni.getLocation({
					type: 'wgs84',
					/* high */
					accuracy: 'best',
					// isHighAccuracy: true,
					// highAccuracyExpireTime: 3000,
					success: function(res) {
						let map = {
							x: res.longitude,
							y: res.latitude
						};
						that.mapData.x = res.longitude
						that.mapData.y = res.latitude
						uni.setStorageSync('map', map)
						console.log('gpsSucess');
						console.log(uni.getStorageSync('map'), "mapamp");
						that.getMap()
					},
					fail: function(err) {
						console.log('gpsFalse');
						// console.log(err, "err");
						//失败调用
						// console.log(that.mapData.x, "x");
						checkOpenGPSServiceByAndroid()
					}
				})
			},

		},
	}
</script>

<style>
	.sele {
		color: #2D81FF;
	}
</style>